/**
 * @description modal框的显示隐藏方法
 * @param title 标题
 * @param onOkText 确定按钮文本
 * @param onCancelText 取消按钮文本
 * @param width 宽度
 * @isConfirm 是否有表单校验
 * @valid 表单校验的值
 */

import {  useState } from "react";

export function useVisble({
  title = "标题",
  okText = "确定",
  cancelText = "取消",
  width = 800,
}) {
  const [open, setOpen] = useState(false);
  const [rowValue, setRowValue] = useState<any>()
  const showModal = (val:any = null) => {
    setOpen(true);
    if(val){
      setRowValue(val)
    }
  };

  const onOk = () => {
    setOpen(false);
  };

  const onCancel = () => {
    setOpen(false);
  };

  return {
    open,
    onOk,
    showModal,
    onCancel,
    title,
    okText,
    cancelText,
    width,
    rowValue
  };
}
